<?php
  function conn(){


   $conn= mysqli_connect('127.0.0.1',"root","");
   
   if (!$conn) {
   	echo "链接错误";
   	exit();
  }
   if (!mysqli_query($conn,"use blog")) {//连接到数据库(mysql_query执行数据库)
   	echo "数据库连接失败";
   	 	exit();
   }
   mysqli_query($conn,"set names utf8"); 
   return $conn;



  }

?>